#include <stdio.h>

int main(){
	int arr[5] = {1,2,3,4,5};
	printf("size = %d \n",sizeof(arr));//20
	printf("size2 = %d \n",sizeof(arr[0]));//4
	printf("数组的长度 = %d \n",sizeof(arr)/sizeof(arr[0]));//对于一维数组有效
	printf("arr[4] = %d \n",arr[4]);//5
	printf("arr[5] = %d \n",arr[5]);//数组下标越界，不一定报错，但其实是错误的操作
	int arr2[] = {1,2,3,4,5};
	printf("arr2size = %d \n",sizeof(arr2)/sizeof(arr[0]));
	int arr3[3] = {1,2,3,4,5};//前短后长
	printf("arr3 = %d \n",sizeof(arr3));
	printf("arr4[4] = %d\n",arr3[4]);//数据丢失
	int arr4[5] = {1};//长度是5长度不足会补0
	printf("arr4 [0] = %d \n arr4[2] = %d \n",arr4[0],arr4[2]);//长度不足会补0
	int arr5[5] = {};//经常用于数组元素清0;
	printf("arr5[0] = %d \n",arr5[0]);
	int arr6[5];//无赋值就随机（全局变量也清0）;
	printf("arr6[0] = %d \n",arr6[0]);
}
